﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>注册到EBS的结果</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- #CSS Links -->
    <!-- Basic Styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.css">

    <!-- SmartAdmin Styles : Caution! DO NOT change the order -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production-plugins.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.css">

    <!-- SmartAdmin RTL Support -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.css">

    <!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/demo.css">

    <!-- #FAVICONS -->
    <link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">

    <!-- #GOOGLE FONT -->
    <link rel="stylesheet" href="css/open-sans.css" type="text/css">

    <!-- #APP SCREEN / ICONS -->
    <link rel="apple-touch-icon" href="img/splash/sptouch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/splash/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/splash/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/splash/touch-icon-ipad-retina.png">

    <!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Startup image for web apps -->
    <link rel="apple-touch-startup-image" href="img/splash/ipad-landscape.png"
        media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
    <link rel="apple-touch-startup-image" href="img/splash/ipad-portrait.png"
        media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
    <link rel="apple-touch-startup-image" href="img/splash/iphone.png" media="screen and (max-device-width: 320px)">

    <link href="appcss/Common.css" rel="stylesheet" />
</head>
<body class="desktop-detected minified">

    <!-- #MAIN PANEL -->
    <div id="main" role="main">

        <!-- RIBBON -->
        <div id="ribbon">

                      <span class="ribbon-button-alignment">
                  <span class="btn btn-ribbon"><i class="fa fa-home"></i></span>
            </span>

            <!-- breadcrumb -->
            <ol class="breadcrumb">
                <li><a href="SchedulingTaskManagement.html">调度任务管理</a></li>
                <li>注册到EBS的结果</li>
            </ol>
            <!-- end breadcrumb -->

        </div>
        <!-- END RIBBON -->


        <!-- MAIN CONTENT -->
        <div id="content">
            <div class="row hidden">
                <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                    <h2 class="page-title txt-color-blueDark">
                        <i class="fa fa-table fa-fw "></i>
                        主页
               
                        <span>注册到EBS的结果
                        </span>
                    </h2>
                </div>
            </div>

            <!-- widget grid -->
            <section id="widget-grid" class="">

                <!-- row -->
                <div class="row" style="margin-top: 8px;">

                    <!-- NEW WIDGET START -->
                    <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

                        <!-- Widget ID (each widget will need unique ID)-->
                        <div class="jarviswidget jarviswidget-sortable" id="wid-id-0"
                            data-widget-editbutton="false">
                            <header>
                                <span class="widget-icon"><i class="fa fa-table"></i></span>

                                <h2>注册到EBS的结果</h2>

                            </header>

                            <!-- widget div-->
                            <div>
                                <div class="widget-body">
                                    <div class="table-responsive">

                                        <table class="table table-bordered  table-hover smart-form" id="datalist-table">
                                            <thead>
                                                <tr>
                                                    <th>任务名称</th>
                                                    <th>事件</th>
                                                    <th>注册结果</th>
                                                    <th>备注</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>

                                    </div>

                                </div>
                                <!-- end widget content -->

                            </div>
                            <!-- end widget div -->

                        </div>

                        <!-- end widget -->

                    </article>
                    <!-- WIDGET END -->

                </div>

                <!-- end row -->

            </section>
            <!-- end widget grid -->
        </div>
        <!-- END MAIN CONTENT -->
    </div>


    <!-- #PLUGINS -->
    <!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->
    

    <script src="js/libs/jquery-2.1.1.min.js"></script>
    <script src="js/libs/jquery-ui-1.10.3.min.js"></script>
    <!-- BOOTSTRAP JS -->
    <script src="js/bootstrap/bootstrap.min.js"></script>

    <!-- IMPORTANT: APP CONFIG -->
    <script src="js/app.config.js"></script>


    <!-- CUSTOM NOTIFICATION -->
    <script src="js/notification/SmartNotification.min.js"></script>

    <!-- JARVIS WIDGETS -->
    <script src="js/smartwidgets/jarvis.widget.min.js"></script>


    <!-- SPARKLINES -->
    <script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>

    <!-- JQUERY MASKED INPUT -->
    <script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>


    <!-- JQUERY UI + Bootstrap Slider -->
    <script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>


    <script src="js/plugin/datatables/jquery.dataTables.min.js"></script>
    <script src="js/plugin/datatables/dataTables.colVis.min.js"></script>
    <script src="js/plugin/datatables/dataTables.tableTools.min.js"></script>
    <script src="js/plugin/datatables/dataTables.bootstrap.min.js"></script>
    <script src="js/plugin/datatable-responsive/datatables.responsive.min.js"></script>
    <script src="appjs/Common.js"></script>
    <script src="appjs/Helper.js"></script>
    <script>
        $(function() {
            getData();
        });
        //初始化表格
        var initializationDataTable = function (dataResult) {
            $('#datalist-table').dataTable({
                "autoWidth": true,
                "oLanguage": {
                    "sProcessing": "正在加载数据...",
                    "sZeroRecords": "没有您要搜索的内容",
                    "sInfo": "从_START_ 到 _END_ /共 _TOTAL_ 条",
                    "sInfoEmpty": "记录数为0",
                    "sInfoFiltered": "(全部记录数 _MAX_  条)",
                    "sInfoPostFix": "",
                    "sUrl": "",
                    "oPaginate": {
                        "sFirst": "第一页",
                        "sPrevious": " 上一页 ",
                        "sNext": " 下一页 ",
                        "sLast": " 最后一页 "
                    }
                },
                paging: false,
                searching: false,
                ordering: false,
                bProcessing: true,
                bStateSave: true,
                //"sAjaxSource": apiUrl,
                //"fnServerData": function(sSource, aoData, fnCallback) {
                //    console.log(JSON.stringify(list));
                //    fnCallback(list);
                //},
                //"aoColumns": [
                //    { "sName": "No" },
                //    { "sName": "Id" },
                //    { "sName": "Code" },
                //    { "sName": "Caption" }
                //],
                data: dataResult,
                columns: [
                    { data: 'TaskName' },
                    { data: 'EventName' },
                    { data: 'IsSuccess' },
                    { data: 'Message' }
                ]
            });
        }
        //获取表格所需的数据并填充到list数组 最后初始化表格
        function getData() {
            $.ajax({
                url: apiUrl,
                type: "POST",
                dataType: "json",
                async: false,
                data: { "sys:sno": "TASK", "sys:act": "Register2EBS" },
                success: function (data) {
                    if (data.IsSccuess) {
                        var list = new Array();
                        for (var i = 0; i < data.Data.Items.length; i++) {
                            var $this = data.Data.Items[i];
                            list.push({ IsSuccess: ($this.IsSuccess ? "成功" : "失败"), EventName: $this.EventName, Message: $this.Message, TaskName: $this.TaskName });
                        }
                        initializationDataTable(list);
                    } else {
                        if (IsLogined(data.ErrorCode)) {
                            alert("错误代码：" + data.ErrorCode + "，错误信息：" + data.Message);
                        }
                    }
                },
                error: function () {
                    alert("系统异常，请稍后重试");
                }
            });
        }
    </script>
</body>
</html>
